using System.Linq;
using EnvDTE;
using HQLAddin.ConfigurationInspector;
using Moq;
using NUnit.Framework;
using SharpTestsEx;

namespace HQLAddin.Tests.Configuration
{
	[TestFixture]
	public class BuildWatcherTests
	{
		[Test]
		public void WhenBuildDoneIsRaisedThenFindPathsAndRaiseBuildSucced()
		{
			var buildEvents = new Mock<BuildEvents>();
			var dte = new Mock<DTE>();
			dte.Setup(d => d.Events.BuildEvents).Returns(buildEvents.Object);


			var eventWasRaised = false;
			var buildWatcher = new BuildWatcher(dte.Object);
			buildWatcher.BuildSucced += (s, a) =>
			{
				eventWasRaised = true;
			};
			buildEvents.Raise(be => be.OnBuildDone += null, vsBuildScope.vsBuildScopeProject, vsBuildAction.vsBuildActionBuild);
			eventWasRaised.Should().Be.True();
		}
	}
}